import React from 'react'
import {Link} from 'react-router-dom'

import AntdIcon from '../../component/antd_icon/antd_icon'

import './article_list_item.css'
/**
 * 文章列表item
 * @param article model.article:{id,title,summary,author,gold,love_cnt,comment_cnt}
 */
class ArticleListItem extends React.Component {

    render() {
        const article = this.props.article
        if (!article) {
            return <span/>
        }
        return (
            <div className="article_list_item">
                <div className="content">
                    <Link to={`/article_info/${article.id}`} className="title">{article.title}</Link>
                    <p className="summary">{article.summary}</p>
                    <div className="desc">
                        <span className="gold"><i className="iconfont icon-diamond"></i> {article.gold}</span>
                        <Link to="#">{article.author}</Link>
                        {article.comment_cnt && <a href={`/article_info/${article.id}#comments`} target="_blank"><i className="iconfont icon-icon_message_fill"></i> {article.comment_cnt}</a>}
                        {article.love_cnt && <span><i className="iconfont icon-xihuan1"></i> {article.love_cnt}</span> }
                    </div>
                </div>
                <div className="cover">
                    {article.cover && <Link to={`/article_info/${article.id}`}>
                        <img src={article.cover} width="100%" />
                    </Link>}
                </div>
            </div>
        )
    }
}

export default ArticleListItem